-- 玩家保底组件
local Guaranteed = Class(function(self, inst)
    self.inst = inst
    self.blueprint_triggers = {}
end, nil, {})

-- 获取玩家蓝图触发次数表
function Guaranteed:getBlueprintTriggers(recipe_name)
    return self.blueprint_triggers[recipe_name] or 0
end

-- 增加该蓝图获取触发次数
function Guaranteed:addBlueprintTriggers(recipe_name, count)
    self.blueprint_triggers[recipe_name] = (self.blueprint_triggers[recipe_name] or 0) + count
end

-- 重置该蓝图获取触发次数为0
function Guaranteed:resetBlueprintTriggers(recipe_name)
    self.blueprint_triggers[recipe_name] = 0
end

function Guaranteed:OnSave()
    return {
        blueprint_triggers = self.blueprint_triggers
    }
end

function Guaranteed:OnLoad(data)
    if data.blueprint_triggers then
        self.blueprint_triggers = data.blueprint_triggers or {}
    end
end

return Guaranteed